home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-taspda.ads < prev    next >
Text File  |  1996-01-30  |  4KB  |  80 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --            S Y S T E M . T A S K _ S P E C I F I C _ D A T A             --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.6 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- The GNAT library is free software; you can redistribute it and/or modify --
  14. -- it under terms of the GNU Library General Public License as published by --
  15. -- the Free Software  Foundation; either version 2, or (at your option) any --
  16. -- later version.  The GNAT library is distributed in the hope that it will --
  17. -- be useful, but WITHOUT ANY WARRANTY;  without even  the implied warranty --
  18. -- of MERCHANTABILITY  or  FITNESS FOR  A PARTICULAR PURPOSE.  See the  GNU --
  19. -- Library  General  Public  License for  more  details.  You  should  have --
  20. -- received  a copy of the GNU  Library  General Public License  along with --
  21. -- the GNAT library;  see the file  COPYING.LIB.  If not, write to the Free --
  22. -- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.        --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  This package contains an interface for manipulation of task specific data
  27.  
  28. package System.Task_Specific_Data is
  29.  
  30.    --  The basic approach is that for every task, there is an allocated
  31.    --  instance of the type TSD, which is a private type used to represent
  32.    --  task specific data.
  33.  
  34.    --  In the non-tasking case, there is one specific instance of the TSD
  35.    --  declared statically in this package, and initialized by the package
  36.    --  body initialization. Together with the interface mechanism provided
  37.    --  in System.Tasking_Soft_Links, this ensures that we can avoid bringing
  38.    --  in the tasking stuff unless tasking is actually active.
  39.  
  40.    --  In the tasking case, a TSD is allocated for each task, saved in the
  41.    --  TCB, and obtained by calling System.Tasking_Soft_Links.Get_TSD_Address.
  42.  
  43.    Non_Tasking_TSD : Address;
  44.    --  A pointer to the TSD allocated for the non-tasking case (this gets
  45.    --  fetched by the non-tasking case version of the Get_TSD_Address
  46.    --  routine in System.Tasking_Soft_Links.
  47.  
  48.    function  Get_Jmpbuf_Address return  Address;
  49.    procedure Set_Jmpbuf_Address (Addr : Address);
  50.    pragma Inline (Get_Jmpbuf_Address);
  51.    pragma Inline (Set_Jmpbuf_Address);
  52.    --  These routines provide a task specific address used to store the
  53.    --  address of the current longjmp/setjmp jump buffer for exception
  54.    --  management (under the current scheme which uses longjmp/setjmp)
  55.  
  56.    function  Get_GNAT_Exception return  Address;
  57.    procedure Set_GNAT_Exception (Addr : Address);
  58.    pragma Inline (Get_GNAT_Exception);
  59.    pragma Inline (Set_GNAT_Exception);
  60.    --  These routines provide a task specific address used to temporarily
  61.    --  store the address of the current exception during propagation.
  62.  
  63.    function  Get_Sec_Stack_Addr return  Address;
  64.    procedure Set_Sec_Stack_Addr (Addr : Address);
  65.    pragma Inline (Get_Sec_Stack_Addr);
  66.    pragma Inline (Set_Sec_Stack_Addr);
  67.    --  These routines provide a task specific address used to reference
  68.    --  the currently allocated secondary stack.
  69.  
  70.    function Create_TSD return Address;
  71.    --  Called from GNULLI when a new thread is created to allocate a new
  72.    --  TSD for the task an return a pointer to this allocated TSD. This
  73.    --  call also performs any required initialization of the TSD.
  74.  
  75.    procedure Destroy_TSD (TSD_Addr : Address);
  76.    --  Called from GNULLI just before a thread is destroyed to release
  77.    --  the storage for the TSD, after performing any required finalization.
  78.  
  79. end System.Task_Specific_Data;
  80.